<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	request.setAttribute("path", path);//只是为了让el表达式更短一些
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<base href="<%=basePath%>">

<title>作业批改</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="expires" content="0">
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="This is my page">
<link rel="icon" href="favicon.ico">

<!-- Bootstrap core CSS -->
<link href="${path}/res/css/bootstrap(2).min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="${path}/res/css/bootstrap-theme.min.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="${path}/res/js/html5shiv.min.js"></script>
      <script src="${path}/res/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="container" ng-app="myapp">
	<jsp:include page="/header.jsp"></jsp:include>
	<!-- =======================header=========================== -->
	<div id="task_detail_div" ng-controller='HomeworkController'>
		<div class="panel-group" role="tablist">
			<div class="panel panel-default">
				<div class="panel-heading panel-title"
					id="collapseListGroupHeading1" data-toggle="collapse"
					data-target="#task_content" style="cursor: pointer;">
					<div class="row">&nbsp;&nbsp;本次作业内容</div>
				</div>

				<div class="panel-collapse panel-body" id="task_content"
					role="tabpanel" aria-labelledby="collapseListGroupHeading1"
					aria-expanded="true">
					<div class="col-sm-offset-1">
						<div class="row form-group">
							<label for="task_teach" class="col-sm-2  control-label">课程</label>
							<div class="col-sm-8">
								<p id="task_teach" ng-bind="task.teach"
									class="form-control-static"></p>
							</div>
						</div>
						<div class="row form-group">
							<label for="task_title" class="col-sm-2  control-label">标题</label>
							<div class="col-sm-8">
								<p id="task_title" ng-bind="task.title"
									class="form-control-static"></p>
							</div>
						</div>
						<div class="row form-group">
							<label for="task_content" class="col-sm-2  control-label">题目</label>
							<div class="col-sm-8">
								<p id="task_content" ng-bind="task.content"
									class="form-control-static"></p>
							</div>
						</div>
						<div class="row form-group">
							<label for="task_attach" class="col-sm-2  control-label">附件</label>
							<div class="col-sm-8">
								<p id="task_attach" class="form-control-static">
									<span ng-if="task.attachID == -1">无</span> <a
										href="download?fileID={{task.attachID}}" data-toggle="tooltip"
										data-placement="left" title="下载" ng-if="task.attachID != -1">
										<span class="glyphicon glyphicon-link">&nbsp;{{task.attach}}</span>
									</a>
								</p>

							</div>
						</div>
						<div class="row form-group">
							<label for="task_deadline" class="col-sm-2  control-label">截止日期</label>
							<div class="col-sm-8">
								<p id="task_deadline" class="form-control-static"
									ng-bind="task.deadline"></p>
							</div>
						</div>
						<div class="row form-group">
							<label for="task_time" class="col-sm-2  control-label">布置时间</label>
							<div class="col-sm-8">
								<p id="time_time" class="form-control-static"
									ng-bind="task.time"></p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="">
			<div class="row clearfix">
				<div class="col-md-12 column">
					<ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a
							href="#uploaded_homework" role="tab" data-toggle="tab">已提交</a></li>
						<li role="presentation"><a href="#uploaded_passed_homework"
							role="tab" data-toggle="tab">已通过</a></li>
						<li role="presentation"><a href="#uncommitted_homework"
							role="tab" data-toggle="tab">未提交</a></li>
					</ul>
					<div class="tab-content">
						<!-- 这是已提交的作业 -->
						<div class="tab-pane active" id="uploaded_homework"
							role="tabpanel">
							<div class="panel-group" role="tablist">
								<div class="panel panel-default">
									<div class="panel-heading panel-title"
										id="collapseListGroupHeading1">
										<div class="row">
											<div class="col-sm-1 col-xs-1 text-center">#</div>
											<div class="col-sm-2 col-xs-2 text-center">姓名</div>
											<div class="col-sm-2 col-xs-2 text-center">学号</div>
											<div class="col-sm-3 col-xs-3 text-center">提交时间</div>
											<div class="col-sm-3 col-xs-3 text-center">附件</div>
											<div class="col-sm-1 col-xs-1 text-center">操作</div>
										</div>
									</div>

									<div class="panel-collapse" id="task_panel" role="tabpanel"
										aria-labelledby="collapseListGroupHeading1"
										aria-expanded="true">
										<ul class="list-group">
											<li class="list-group-item"
												ng-repeat="row in uploaded_homeworks"
												ng-mouseover="mousein($index)">
												<div class="row" data-toggle="tooltip" data-placement="left"
													title="学生备注：{{row.note}}">
													<div class="col-sm-1 col-xs-1 text-center" ng-bind="$index"></div>
													<div class="col-sm-2 col-xs-2 text-center"
														ng-bind="row.userName" data-toggle="collapse"
														data-target="#demo1{{$index}}" style="cursor: pointer;"></div>
													<div class="col-sm-2 col-xs-2 text-center"
														ng-bind="row.userID"></div>
													<div class="col-sm-3 col-xs-3 text-center"
														ng-bind="row.time"></div>
													<!-- 没有附件的情况 -->
													<div class="col-sm-3 col-xs-3 text-center"
														ng-if="row.attachID == -1" ng-bind="row.attach"></div>
													<!-- 有附件的情况 -->
													<div class="col-sm-3 col-xs-3 text-center"
														ng-if="row.attachID != -1">
														<a href="download?fileID={{row.attachID}}"
															data-toggle="tooltip" data-placement="left" title="下载">
															<span class="glyphicon glyphicon-link">&nbsp;{{row.attach}}</span>
														</a>
													</div>
													<div class="col-sm-1 col-xs-1 text-center"
														ng-show='$index == selectedRow'>

														<a href="javascript:void(0);" data-toggle="tooltip"
															ng-click="correct($index)" data-placement="left"
															title="批改作业"> <span
															class="glyphicon glyphicon-pencil"></span>
														</a>&nbsp;<a href="javascript:void(0);"
															ng-click="remove($index，1)" data-toggle="tooltip"
															data-placement="left" title="删除"> <span
															class="glyphicon glyphicon-remove-circle"></span>
														</a>
													</div>
												</div>
												<div id="demo1{{$index}}" class="collapse">
													<p>
														内容：<br /> <span class="col-sm-offset-1"
															ng-bind="row.content"></span>
													</p>
												</div>
											</li>
										</ul>

									</div>
								</div>
							</div>
						</div>


						<!-- 这是已通过的作业 -->
						<div class="tab-pane" id="uploaded_passed_homework"
							role="tabpanel">
							<div class="panel-group" role="tablist">
								<div class="panel panel-default">
									<div class="panel-heading panel-title"
										id="collapseListGroupHeading1">
										<div class="row">
											<div class="col-sm-1 col-xs-1 text-center">#</div>
											<div class="col-sm-2 col-xs-2 text-center">姓名</div>
											<div class="col-sm-2 col-xs-2 text-center">学号</div>
											<div class="col-sm-3 col-xs-3 text-center">提交时间</div>
											<div class="col-sm-3 col-xs-3 text-center">附件</div>
											<div class="col-sm-1 col-xs-1 text-center">操作</div>
										</div>
									</div>

									<div class="panel-collapse" id="task_panel" role="tabpanel"
										aria-labelledby="collapseListGroupHeading1"
										aria-expanded="true">
										<ul class="list-group">
											<li class="list-group-item"
												ng-repeat="row in uploaded_passed_homeworks"
												ng-mouseover="mousein($index)">
												<div class="row" data-toggle="tooltip" data-placement="left"
													title="学生备注：{{row.note}}">
													<div class="col-sm-1 col-xs-1 text-center" ng-bind="$index"></div>
													<div class="col-sm-2 col-xs-2 text-center"
														ng-bind="row.userName" data-toggle="collapse"
														data-target="#demo2{{$index}}" style="cursor: pointer;"></div>
													<div class="col-sm-2 col-xs-2 text-center"
														ng-bind="row.userID"></div>
													<div class="col-sm-3 col-xs-3 text-center"
														ng-bind="row.time"></div>
													<!-- 没有附件的情况 -->
													<div class="col-sm-3 col-xs-3 text-center"
														ng-if="row.attachID == -1" ng-bind="row.attach"></div>
													<!-- 有附件的情况 -->
													<div class="col-sm-3 col-xs-3 text-center"
														ng-if="row.attachID != -1">
														<a href="download?fileID={{row.attachID}}"
															data-toggle="tooltip" data-placement="left" title="下载">
															<span class="glyphicon glyphicon-link">&nbsp;{{row.attach}}</span>
														</a>
													</div>
													<div class="col-sm-1 col-xs-1 text-center"
														ng-show='$index == selectedRow'>

														<a href="javascript:void(0);" ng-click="review($index)"
															data-toggle="tooltip" data-placement="left" title="查看详情">
															<span class="glyphicon glyphicon-eye-open"></span>
														</a> &nbsp; <a href="javascript:void(0);"
															ng-click="remove($index，2)" data-toggle="tooltip"
															data-placement="left" title="删除"> <span
															class="glyphicon glyphicon-remove-circle"></span>
														</a>
													</div>
												</div>
												<div id="demo2{{$index}}" class="collapse">
													<p>
														题目：<br /> <span class="col-sm-offset-1"
															ng-bind="row.content"></span>
													</p>
												</div>
											</li>
										</ul>

									</div>
								</div>
							</div>
						</div>

						<!-- 这是未提交的作业 -->
						<div class="tab-pane" id="uncommitted_homework">
							<div class="panel-group" role="tablist">
								<div class="panel panel-default">
									<div class="panel-heading panel-title"
										id="collapseListGroupHeading1">
										<div class="row">
											<div class="col-sm-1 col-xs-1 text-center">#</div>
											<div class="col-sm-3 col-xs-3 text-center">姓名</div>
											<div class="col-sm-4 col-xs-4 text-center">学号</div>
											<div class="col-sm-4 col-xs-4 text-center">操作</div>
										</div>
									</div>

									<div class="panel-collapse" id="task_panel" role="tabpanel"
										aria-labelledby="collapseListGroupHeading1"
										aria-expanded="true">
										<ul class="list-group">
											<li class="list-group-item"
												ng-repeat="(id,name) in uncommitted_users"
												ng-mouseover="mousein($index)">
												<!-- 这里需要修改 -->
												<div class="row" data-toggle="tooltip" data-placement="left"
													title="">
													<div class="col-sm-1 col-xs-1 text-center" ng-bind="$index"></div>
													<div class="col-sm-3 col-xs-3 text-center" ng-bind="id"></div>
													<div class="col-sm-4 col-xs-4 text-center" ng-bind="name"></div>
													<div class="col-sm-4 col-xs-4 text-center"
														ng-show='$index == selectedRow'>

														<a href="javascript:void(0);" ng-click="remind($index)"
															data-toggle="tooltip" data-placement="left" title="提醒">
															<span class="glyphicon glyphicon-eye-open"></span>
														</a> &nbsp;<a href="javascript:void(0);"
															ng-click="remove($index,3)" data-toggle="tooltip"
															data-placement="left" title="删除"> <span
															class="glyphicon glyphicon-remove-circle"></span>
														</a>
													</div>
												</div>
											</li>
										</ul>

									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- 作业查看框 -->
	<div class="modal fade" id="preview_modal_homework" tabindex="-1"
		role="dialog" aria-labelledby="preview_modal_homework_label"
		aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
					</button>
					<h4 class="modal-title" id="preview_modal_homework_label">查看作业</h4>
				</div>
				<div class="modal-body">
					<!-- 查看作业内容区 -->
					<div id="preview_homework">
						<div class="col-sm-offset-2">
							<div class="row form-group">
								<label for="preview_homework_content"
									class="col-sm-2  control-label">答案</label>
								<div class="col-sm-8">
									<p id="preview_homework_content" class="form-control-static"></p>
								</div>
							</div>
							<div class="row form-group">
								<label for="preview_homework_attach"
									class="col-sm-2  control-label">附件</label>
								<div class="col-sm-8">
									<p id="preview_homework_attach" class="form-control-static"></p>
								</div>
							</div>
							<div class="row form-group">
								<label for="preview_homework_note"
									class="col-sm-2  control-label">学生备注</label>
								<div class="col-sm-8">
									<p id="preview_homework_note" class="form-control-static"></p>
								</div>
							</div>
							<div class="row form-group">
								<label for="preview_homework_pass"
									class="col-sm-2  control-label">是否通过</label>
								<div class="col-sm-8">
									<p id="preview_homework_pass" class="form-control-static"></p>
								</div>
							</div>
							<div class="row form-group">
								<label for="preview_homework_score"
									class="col-sm-2  control-label">分数</label>
								<div class="col-sm-8">
									<p id="preview_homework_score" class="form-control-static"></p>
								</div>
							</div>
							<div class="row form-group">
								<label for="preview_homework_evaluation"
									class="col-sm-2  control-label">教师批注</label>
								<div class="col-sm-8">
									<p id="preview_homework_evaluation" class="form-control-static"></p>
								</div>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>

	<!-- 作业批改框 -->
	<div class="modal fade" id="modal_correct_homework" tabindex="-1"
		role="dialog" aria-labelledby="modal_correct_homework_label"
		aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
					</button>
					<h4 class="modal-title" id="modal_correct_homework_label">查看作业</h4>
				</div>
				<div class="modal-body">
					<!-- 查看作业内容区 -->
					<div id="correct_homework">
						<form  id="correct_homework_form" action="task/correct" class="form-horizontal" ethod="post"
							role="form" accept-charset="UTF-8">
							<div class="col-sm-offset-2">
								<div class="row form-group">
									<label for="correct_homework_content"
										class="col-sm-2  control-label">答案</label>
									<div class="col-sm-8">
										<p id="correct_homework_content" class="form-control-static"></p>
									</div>
								</div>
								<div class="row form-group">
									<label for="correct_homework_attach"
										class="col-sm-2  control-label">附件</label>
									<div class="col-sm-8">
										<p id="correct_homework_attach" class="form-control-static"></p>
									</div>
								</div>
								<div class="row form-group">
									<label for="correct_homework_note"
										class="col-sm-2  control-label">学生备注</label>
									<div class="col-sm-8">
										<p id="correct_homework_note" class="form-control-static"></p>
									</div>
								</div>
								<!-- <div class="row form-group">
									<label for="correct_homework_pass"
										class="col-sm-2  control-label">是否通过</label>
									<div class="col-sm-8">
										<p id="preview_homework_pass" class="form-control-static"></p>
									</div>
								</div> -->
								<div class="row form-group">
									<label for="correct_homework_score"
										class="col-sm-2  control-label">分数</label>
									<div class="col-sm-8">
									<input id="correct_homework_score" type="number" name="homework.score">
									</div>
								</div>
								<div class="row form-group">
									<label for="correct_homework_evaluation"
										class="col-sm-2  control-label">批注</label>
									<div class="col-sm-8">
										<input id="correct_homework_evaluation" type="text" name="homework.evaluation">
				
									</div>
								</div>
									<div class="form-group">
									<div class="col-sm-offset-2 col-sm-8">
										<p id="status" class="form-control-static text-success"
											style="margin-bottom: 20px;"></p>
									</div>
								</div>
								<input type="hidden" id="correct_homework_id" name="homework.id">
								<input type="hidden" id="row_num" name="rowNum">
							</div>
						</form>
					</div>
				</div>
				<div class="modal-footer">
					<input form="correct_homework_form" class="btn btn-success btn-lg"
						id="submit_btn" type="submit" value="提交"> <input
						id="reset_btn" form="correct_homework_form" class="btn btn-warning"
						type="reset" value="重置">
					<!-- 	 <a id="submit_homework_btn"
						class="btn btn-primary" href="#">提交</a> <a
						id="submit_homework_btn" class="btn btn-primary" href="#">提交</a> -->
				</div>
			</div>
		</div>
	</div>

	<!-- ========================footer========================== -->
	<jsp:include page="/footer.jsp"></jsp:include>
	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="${path}/res/js/jquery.min.js"></script>
	<script src="${path}/res/js/bootstrap.min.js"></script>
	<script src="${path}/res/js/jquery.fileupload.js"></script>
	<script src="${path}/res/js/jquery.iframe-transport.js"></script>
	<script src="${path}/res/js/jquery.ui.widget.js"></script>
	<script src="${path}/res/js/jquery.form.js"></script>
	<script src="${path}/res/js/angular.min.js"></script>
	<script src="${path}/res/js/task_detail.js"></script>
	<script type="text/javascript">
		var homeworks1 = '${homeworkJson}';
	</script>
</body>
</html>
